package com.android.phoenix.util;

import java.io.File;

/**
 * @author hyx
 * 删除缓存文件
 *
 */
public class CacheClearUtil {

	public static boolean clear(String cachePath) {
		File f = new File(cachePath);
		boolean result = false;
		if(f.exists() && f.isDirectory()) {
			File[] fChild = f.listFiles();
			for(int i = 0;i<fChild.length;i++) {
				if(fChild[i].isDirectory()) {
//					递归判断是否是目录
					clear(fChild[i].getPath());
					fChild[i].delete();
				} else {
					fChild[i].delete();
				}
			}
			result = true;
		} else {
			result = false;
		}
		return result;
	}
}
